<%@ page import="java.util.Iterator" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>属性操作</title>
    <style>
        .wrapper {
            border: 1px solid blue;
            margin: 15px auto;
        }
    </style>
</head>
<body>

    <div class="wrapper">
        <p>操作ServletContext中的属性</p>
    </div>

    <div class="wrapper">
        <p>操作会话(HttpSession)中的属性</p>
        <form action="${pageContext.request.contextPath}/session/attribute" method="post">
            属性名:
            <input type="text" name="name">
            属性值:
            <input type="text" name="value">
            <button type="submit">提交</button>
        </form>
        <%
            Iterator<String> it = session.getAttributeNames().asIterator();
            while(it.hasNext()) {
                String name = it.next();
        %>
            <p>
                <a href="/session/attribute?attr=<%= name %>">删除<%=name%>属性</a>
            </p>
        <% } %>
    </div>

    <div class="wrapper">
        <p>操作ServletRequest中的属性</p>
    </div>

</body>
</html>
